<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: stefanfrings::HttpRequestHandler Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classstefanfrings_1_1HttpRequestHandler.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classstefanfrings_1_1HttpRequestHandler-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">stefanfrings::HttpRequestHandler Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The request handler generates a response for each HTTP request.  
 <a href="classstefanfrings_1_1HttpRequestHandler.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="httprequesthandler_8h_source.html">httprequesthandler.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stefanfrings::HttpRequestHandler:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1HttpRequestHandler__inherit__graph.png" border="0" usemap="#astefanfrings_1_1HttpRequestHandler_inherit__map" alt="Inheritance graph"/></div>
<map name="astefanfrings_1_1HttpRequestHandler_inherit__map" id="astefanfrings_1_1HttpRequestHandler_inherit__map">
<area shape="rect" title="The request handler generates a response for each HTTP request." alt="" coords="5,80,195,121"/>
<area shape="rect" href="classstefanfrings_1_1StaticFileController.html" title="Delivers static files." alt="" coords="16,169,184,211"/>
<area shape="rect" title=" " alt="" coords="63,5,137,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for stefanfrings::HttpRequestHandler:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1HttpRequestHandler__coll__graph.png" border="0" usemap="#astefanfrings_1_1HttpRequestHandler_coll__map" alt="Collaboration graph"/></div>
<map name="astefanfrings_1_1HttpRequestHandler_coll__map" id="astefanfrings_1_1HttpRequestHandler_coll__map">
<area shape="rect" title="The request handler generates a response for each HTTP request." alt="" coords="5,80,195,121"/>
<area shape="rect" title=" " alt="" coords="63,5,137,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a436ce22e3f9d0187e1718e010f0b8a32"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a436ce22e3f9d0187e1718e010f0b8a32">HttpRequestHandler</a> (QObject *parent=nullptr)</td></tr>
<tr class="memdesc:a436ce22e3f9d0187e1718e010f0b8a32"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="classstefanfrings_1_1HttpRequestHandler.html#a436ce22e3f9d0187e1718e010f0b8a32">More...</a><br /></td></tr>
<tr class="separator:a436ce22e3f9d0187e1718e010f0b8a32"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32bf6b0e36dbdb4cd0525d2c4b54fdec"><td class="memItemLeft" align="right" valign="top"><a id="a32bf6b0e36dbdb4cd0525d2c4b54fdec"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a32bf6b0e36dbdb4cd0525d2c4b54fdec">~HttpRequestHandler</a> ()</td></tr>
<tr class="memdesc:a32bf6b0e36dbdb4cd0525d2c4b54fdec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a32bf6b0e36dbdb4cd0525d2c4b54fdec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a7210907152c46b8b5a47feb64cf6bd"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a0a7210907152c46b8b5a47feb64cf6bd">service</a> (<a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;request, <a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;response)</td></tr>
<tr class="memdesc:a0a7210907152c46b8b5a47feb64cf6bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate a response for an incoming HTTP request.  <a href="classstefanfrings_1_1HttpRequestHandler.html#a0a7210907152c46b8b5a47feb64cf6bd">More...</a><br /></td></tr>
<tr class="separator:a0a7210907152c46b8b5a47feb64cf6bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The request handler generates a response for each HTTP request. </p>
<p>Web Applications usually have one central request handler that maps incoming requests to several controllers (servlets) based on the requested path. </p>
<p>You need to override the <a class="el" href="classstefanfrings_1_1HttpRequestHandler.html#a0a7210907152c46b8b5a47feb64cf6bd" title="Generate a response for an incoming HTTP request.">service()</a> method or you will always get an HTTP error 501. </p>
<dl class="section warning"><dt>Warning</dt><dd>Be aware that the main request handler instance must be created on the heap and that it is used by multiple threads simultaneously. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classstefanfrings_1_1StaticFileController.html" title="Delivers static files.">StaticFileController</a> which delivers static local files. </dd></dl>

<p class="definition">Definition at line <a class="el" href="httprequesthandler_8h_source.html#l00027">27</a> of file <a class="el" href="httprequesthandler_8h_source.html">httprequesthandler.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a436ce22e3f9d0187e1718e010f0b8a32"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a436ce22e3f9d0187e1718e010f0b8a32">&#9670;&nbsp;</a></span>HttpRequestHandler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HttpRequestHandler::HttpRequestHandler </td>
          <td>(</td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>nullptr</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">parent</td><td>Parent object. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httprequesthandler_8cpp_source.html#l00010">10</a> of file <a class="el" href="httprequesthandler_8cpp_source.html">httprequesthandler.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a0a7210907152c46b8b5a47feb64cf6bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0a7210907152c46b8b5a47feb64cf6bd">&#9670;&nbsp;</a></span>service()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void HttpRequestHandler::service </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;&#160;</td>
          <td class="paramname"><em>response</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Generate a response for an incoming HTTP request. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>The received HTTP request </td></tr>
    <tr><td class="paramname">response</td><td>Must be used to return the response </td></tr>
  </table>
  </dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>This method must be thread safe </dd></dl>

<p>Reimplemented in <a class="el" href="classstefanfrings_1_1StaticFileController.html#a88bbd874c62c8335d0775629b22871a1">stefanfrings::StaticFileController</a>.</p>

<p class="definition">Definition at line <a class="el" href="httprequesthandler_8cpp_source.html#l00017">17</a> of file <a class="el" href="httprequesthandler_8cpp_source.html">httprequesthandler.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>httpserver/<a class="el" href="httprequesthandler_8h_source.html">httprequesthandler.h</a></li>
<li>httpserver/<a class="el" href="httprequesthandler_8cpp_source.html">httprequesthandler.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>stefanfrings</b></li><li class="navelem"><a class="el" href="classstefanfrings_1_1HttpRequestHandler.html">HttpRequestHandler</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
